package exception;

public class Person {
    static int age;

    public static int getAge() {
        return age;
    }

    public void setAge(int age)throws IllegalAgeException{
        if(0>age||age>100){
            //throw new RuntimeException("年龄不合法");
            //throw new  Exception("年龄不合法");
            throw new IllegalAgeException("年龄超出了范围(0-100):"+age);
        }
        this.age = age;
    }
}
